package Book;
//这是书架类
public class BookList {
    //4. 书架类的属性 用Book的数组来存放书
    //Book类的数组
    private Book[] books = new Book[10];
    //书的数量
    private int usedSize;
    //书架的构造函数 已经放好了三本书
    //5. 书架上已经方法了三本书 书是怎么来的 是new出来的
    public BookList(){
        books[0] = new Book("三国演义","罗贯中",17,"小说");
        books[1] = new Book("西游记","吴承恩",47,"小说");
        books[2] = new Book("水浒传","施耐庵",37,"小说");
        this.usedSize = 3;
    }
    /*
    * 默认放在顺序表的最后
    * */
    //6. 往书籍上放书 拿书 对usedSize进行设置get和set方法
    public void setBooks(int pos,Book book){
        this.books[pos] = book;
    }
    public Book getBook(int pos){
        return this.books[pos];
    }
    public int getUsedSize(){
        return usedSize;
    }
    public void setUsedSize(int usedSize){
        this.usedSize = usedSize;
    }
}
